<?php
class CommonHelper{
	public static function getSubcategoryShop($parentCat){
		$rootCat = FrontendShopCategoryModel::getCategory($parentCat);
		if(count($rootCat)>0){
			echo '<ul>';
			foreach ($rootCat as $key => $item){
				$link = Yii::app()->controller->createUrlProductCat($item['category_id']);
				echo '<li><a href="'.$link.'" >'.$item['title'].'</a>';
				self::getSubcategoryShop($item['category_id']);         // *
				echo '</li>';
			}
			echo '</ul>';
		}
	}
	public static function getImageThumbNews($images, $type='thumb')
	{
		if(empty($images)){
			return '';
		}
		$images = unserialize($images);
		return Yii::app()->getBaseUrl().'/storage'.$images["$type"]['url'];
	}
	public static function formatDateTime()
	{
		return 'Ngày '.date('d/m/Y');
	}
}